/Users/kiltum/projects/zxcpp/include/memory.hpp
Line | Count | Source |
1 | | #ifndef MEMORY_HPP |
2 | | #define MEMORY_HPP |
3 | | |
4 | | #include <cstdint> |
5 | | |
6 | | class Memory |
7 | | { |
8 | | private: |
9 | | uint8_t bank[8][16384]; // banks of memory |
10 | | uint8_t rom[2][16384]; // banks of ROMs |
11 | | bool is48; // machine version |
12 | | uint8_t bankMapping[4]; // Which bank mapped now |
13 | | bool ULAShadow; |
14 | | |
15 | | public: |
16 | | // Constructor |
17 | | Memory(); |
18 | | |
19 | | // Read a byte from memory |
20 | | uint8_t ReadByte(uint16_t address); |
21 | | // Special function for ULA reading screen (main or shadow) |
22 | | uint8_t ULAReadByte(uint16_t address); |
23 | | // Write a byte to memory |
24 | | void WriteByte(uint16_t address, uint8_t value); |
25 | | |
26 | | // Load 48k rom to memory |
27 | | void Read48(void); |
28 | | // load 128 rom to memory |
29 | | void Read128(void); |
30 | | // Load diag rom to memory |
31 | | void ReadDiag(void); |
32 | | // load another diag rom |
33 | | void ReadDiag2(void); |
34 | | |
35 | | // true, is we emulate 48k. No banks, no any reaction to write to 7FFD. false - we emulate 128k |
36 | | void change48(bool is48s); |
37 | | void writePort(uint16_t port, uint8_t value); // handler for 7ffd |
38 | 0 | bool getIs48() const { return is48; } // Getter for is48 flag |
39 | | bool canWriteRom; // Can we overwrite ROM, as in Baltika version? Its public, because test need it |
40 | | }; |
41 | | |
42 | | #endif // MEMORY_HPP |